<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager, com.scalar.chiptrack.sales.CustomerRelationship"%>
<%
    String chipTracContext = "/" + ConfigManager.getChipTracContext();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<script>
function selectParentChild(){

	newWindow = window.open('<%=chipTracContext%>/jsp/sales/parent_child_relationship.jsp','optionsPopup',
		'channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=800,height=700,resizable=no');
	if(!newWindow.opener) {newWindow.opener = window}
	newWindow.focus();
}

function selectODM(){

	var form =  document.customer_relationship_display;
	var customerId = form.customerId.value;
	var customerName = form.customerName.value;
    //newWindow = window.open('<%=chipTracContext%>/customerRelationshipSearch.do?action=searchodms&customerId='+customerId+'&customerName='+customerName,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=550,height=520,resizable=no');
    var LeftPos=(screen.width)?(screen.width-500)/2:100;
    var TopPos=(screen.height)?(screen.height-450)/2:100;
	newWindow = window.open ('<%=chipTracContext%>/customerRelationshipSearch.do?action=searchodms&customerId='+customerId+'&customerName='+customerName,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=540,height=500,resizable=yes,Left= '+LeftPos+',top='+TopPos);
	if(!newWindow.opener) {newWindow.opener = window}
	newWindow.focus();
}

function selectEndcustomer(){

	var form =  document.customer_relationship_display;
	var customerId = form.customerId.value;
	var customerName = form.customerName.value;
	//newWindow = window.open('<%=chipTracContext%>/customerRelationshipSearch.do?action=searchendcustomers&customerId='+customerId+'&customerName='+customerName,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=550,height=520,resizable=no');
    var LeftPos=(screen.width)?(screen.width-500)/2:100;
    var TopPos=(screen.height)?(screen.height-450)/2:100;
	newWindow = window.open ('<%=chipTracContext%>/customerRelationshipSearch.do?action=searchendcustomers&customerId='+customerId+'&customerName='+customerName,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=540,height=500,resizable=yes,Left= '+LeftPos+',top='+TopPos);
	if(!newWindow.opener) {newWindow.opener = window}
	newWindow.focus();
}

function back()
{
    document.customer_relationship_display.action.value = "search";
    document.customer_relationship_display.submit();
}

</script>

<!-- Top Header Start-->

<%@ include file="/jsp/includes/header.jsp" %>

<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->

	<%@ include file="/jsp/sales/sales_menu.jsp" %>

    </TD>
<!-- end of the side navigations -->
    <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
    <TD valign="top" width="100%">
        <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
        <BR>
<!-- from here your body starts -->

<html:form name="customer_relationship_display" method="post" action="/customerRelationshipSearch.do" scope="request" type="com.scalar.chiptrack.sales.forms.CustomerRelationshipSearchForm" onsubmit="javascript:return searchCustomer(document.customer_relationship_search);">
        <center><span class="NArialW">Customer Relationships</span></center>
        <%--<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>--%>

        <table border="0" width="80%" align=center>
         <tr><td colspan =7 align="left" class='NArialL'><font styleClass="NArialL" id="message1" color="green"  />&nbsp;</font></td></tr>
         <%--  <tr><td colspan =7 align="left" class='NArialL'><font styleClass="NArialL" id="message2" color="FF0000"  />&nbsp;</font></td></tr>--%>
          <!--<tr><td colspan =7 class="NArialL"><chiptrack:info styleClass="NArialL" /></td></tr> -->
          <!--<tr><td colspan =7 class="NArialL"><chiptrack:errors styleClass="NArialL" /></td></tr> -->
          <tr><td>
                <table border="0" width="100%">
                  <tr>
                    <td class="NArialL"> Customer Name : <%= (String)request.getAttribute("customerName")%></td>
                  </tr>
                  <tr><td width="100%">

                    <!-- <table border = 0 width= "100%">
                    <tr bgcolor='#993333' class="NArialL"><td colspan=150 ><font color=#FFFFFF >Parent/ Child Relationship</font></td></tr>
                    <tr><td>
                        <table width = 100% class='NArialL' border="1" cellpadding=0>
                        <tr bgcolor='#993333' border=0>
                            <td><font color=#FFFFFF>Parent</font></td>
                            <td><font color=#FFFFFF>Child</font> </td>
                        </tr>
                  <% int bgcount = 0; %>
                  <logic:iterate id="CustomerRelationship" name="parentChildList">
                  <% bgcount = bgcount+1; %>
                  <tr <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> border=0>
                    <td><bean:write name="CustomerRelationship" property="parentCustomerName" /></td>
                    <td><bean:write name="CustomerRelationship" property="childCustomerName" /></td>
                  </tr>
                  </logic:iterate>
                  </table>
                  </td>
                  <td class="NArialL">
                    <a href="javascript.selectParentChild()" onmouseover="window.status='Click to select Parent/ Child';return true"
                    onmouseout="window.status='';return true" class="link">Click here </a>to add new Parent/ Child Relationship</td></tr>
                  </td>
                  </tr>
                </table> -->
         </td></tr>
         <tr><td>&nbsp;</td></tr>
         <tr><td>
                <table border = "0" width= "100%">
            <tr class="NArialL" height="20"><td colspan='150' bgcolor='#DEE1E2' align="center" ><font class='NArialL'><bean:message key="label.sales.endCustomer"/> Relationship</font></td></tr>

            <tr class='NArialL' ><td colspan='150' align="center" >&nbsp;</td>  </tr>

            <tr  class='NArialL'><td align="center" bgcolor='#993333'><font color="#FFFFFF"><bean:message key="label.sales.endCustomer"/> List</font></td>
            <td>&nbsp;
                    <logic:notEqual name="action" value="view">
                    <a href="javascript:selectODM()" onmouseover="window.status='Click to select <bean:message key="label.sales.endCustomer"/> List';return true"
                    onmouseout="window.status='';return true" class="link">Click here </a> to Add / Remove <bean:message key="label.sales.endCustomer"/> Relationship
                    </logic:notEqual>
            </td>
            </tr>
            <tr><td width="40%">
                <table width = "100%" class='NArialL' >
                <tr align="center" bgcolor='#993333'>
                <% bgcount = 0; %>
                <logic:iterate id="CustomerRelationship" name="odmList">
                <% bgcount = bgcount+1; %>
                <tr <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%> border=0>
                    <td><bean:write name="CustomerRelationship" property="childCustomerName" />
                    </td>
                </tr>
                </logic:iterate>
                </table>
                </td>
            </tr>
            </table>
         </td></tr>
         <tr><td>&nbsp;</td></tr>
         <tr><td>
                <table border = "0" width= "100%">
            <%--<tr bgcolor='#993333' class="NArialL"><td colspan=150 ><font color=#FFFFFF >End Customer Relationship</font></td></tr> --%>
            <tr class="NArialL" height="20"><td colspan='150' bgcolor='#DEE1E2' align="center" ><font class='NArialL'><bean:message key="label.sales.endUser"/> Relationship</font></td>
            <tr class='NArialL' ><td colspan='150' align="center" >&nbsp;</td>  </tr>

             <tr class='NArialL' align="center"  ><td bgcolor='#993333'><font color=#FFFFFF><bean:message key="label.sales.endUser"/> List</font></td>
                <td>
                <logic:notEqual name="action" value="view">
                    <a href="javascript:selectEndcustomer()" onmouseover="window.status='Click to select <bean:message key="label.sales.endUser"/>';return true"
                    onmouseout="window.status='';return true" class="link">Click here </a>to Add / Remove <bean:message key="label.sales.endUser"/> Relationship
                </logic:notEqual>
                </td>
             </tr>
            <tr><td width="40%">
                <table width = "100%" class='NArialL' >
                <tr align="center" bgcolor='#993333'>
                <% bgcount = 0; %>
                <logic:iterate id="CustomerRelationship" name="endCustomerList">
                <% bgcount = bgcount+1; %>
                <tr <%if(bgcount%2==0){%> bgcolor='#DEE1E2' <% } else {%> bgcolor='#FFFFEE' <%}%>  border=0>
                    <td ><bean:write name="CustomerRelationship" property="childCustomerName" /></td>

                </tr>
                </logic:iterate>
                </table>
                </td>

            </tr>
            </table>
         </td></tr>
         <tr><td>&nbsp;</td></tr>
         <tr>
            <td align = "center">
               <a href="javaScript:back()" onmouseover="window.status='Click to go Back';return true" onmouseout="window.status='';return true" title="Click here to go Back"> <img border="0" src="<%=chipTracContext%>/jsp/includes/images/back.gif"/></a>&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
            <td></td>
         </tr>
         </table>

          </td></tr>
        </table>

        <input type="hidden" name="action" value="">
        <input type="hidden" name="customerName" value="<%= (String)request.getAttribute("customerName")%>" >
        <input type="hidden" name="customerId" value="<%= (String)request.getAttribute("customerId")%>">

        </html:form>

        <!-- till here -->
        <BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->

<%@ include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->

</BODY>
</HTML>
